import java.util.Scanner;

public class Test {

    // 编写代码模拟三次密码输入的场景。 最多能输入三次密码，密码正确，
    // 提示“登录成功”,密码错误， 可以重新输入，最多输入三次。三次均错，则提示退出程序
    public static void login(){
        // 假设密码:123abc
        int count = 3;
        Scanner in = new Scanner(System.in);
        while(count != 0){
            System.out.println("请输入你的密码:");
            String pass = in.nextLine();
            if(pass.equals("123abc")){
                System.out.println("登录成功");
                return;
            }else{
                count--;
                System.out.println("登录失败,剩下 " + count + " 次机会");
            }
        }
    }

    public static int fib(int n){
        int f1 = 1;
        int f2 = 1;
        int f3 = 0;

        for(int i = 3; i <= n; i++){
            f3 = f1 + f2;
            f1 = f2;
            f2 = f3;
        }

        if(f3 == 0){
            return 1;
        }else{
            return f3;
        }
    }

    public static void test(){
        int i = 1;
        while(i <= 100){
            if(i % 3 != 0){
                i++; // 这里i要++，否则死循环
                continue;
            }

            System.out.println(i);
            i++;
        }
    }

    public static int max(int x, int y){
        return x > y ? x : y;
    }

    public static double max(double x, double y, double z){
        /*double tmp = x > y ? x : y;
        return tmp > z ? tmp : z;*/

        double tmp = Math.max(x, y);
        return Math.max(tmp, z);
    }

    public static int fac(int n){
        if(n == 1){
            return 1;
        }

        return n * fac(n-1);
    }

    public static int sumN(int n){
        if(n == 1){
            return 1;
        }

        return n + sumN(n-1);
    }

    public static void print(int num){
        if(num <= 9){
            System.out.println(num);
            return;
        }

        print(num/10);
        System.out.println(num%10);
    }

    public static int eveSum(int num){
        if(num <= 9){
            return num;
        }

        int tmpSum = num % 10;
        return tmpSum + eveSum(num/10);
    }

    public static int count = 0;

    public static void move(char posSrc, char posDest){
        System.out.print(posSrc + "->" + posDest + " ");
    }

    public static void hanoi(int n, char pos1, char pos2, char pos3){
        if(n == 1){
            move(pos1, pos3);
            return;
        }

        hanoi(n-1, pos1, pos3, pos2);
        move(pos1, pos3);
        hanoi(n-1, pos2, pos1, pos3);
    }

    public static int fibN(int n){
        if(n == 1 || n == 2){
            return 1;
        }

        /*if(n == 3){
            count++;
        }*/

        return fibN(n-1) + fibN(n-2);
    }
    public static void main(String[] args) {
        /*int ret = fib(4);
        System.out.println(ret);*/
        // login();

        /*int ret1 = max(10, 20);
        double ret2 = max(3.14, 2.6, 9.6);
        System.out.println("ret1 = " + ret1);
        System.out.println("ret2 = " + ret2);*/

        /*int ret3 = fac(5);
        System.out.println(ret3);*/

        /*int ret4 = sumN(10);
        System.out.println("ret4 = " + ret4);*/

        /*int ret5 = eveSum(1234);
        System.out.println(ret5);*/

        /*int ret6 = fibN(3);
        // System.out.println(count);
        System.out.println(ret6);*/

        // hanoi(3, 'A', 'B', 'C');
    }

}
